<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const sourse = {
            a:123,
            b:456
        }
        const target = {
            c:123,
            b:666
        }
const result=Object.assign(target,sourse);
console.log(target)
// 相同属性名的替换属性值，没有的属性名添加属性值和属性名


const obj={
    age:18,
    name:"yy"
}
console.log(obj)

function fun(obj){
    // const obj1 = Object.assign({},obj)
    obj.name="zz"
    obj.sex="man"
    console.log(obj)
}
fun(obj)



    </script>
</body>
</html>